#include <string.h>
#include "../lexerparser/lp_defs.h"
/*! Determines current location by incrementing length of text
	\param[in] text
*/
void compute(const char *  text)
{
 int pp=0;
 const char * ttext=text;
 while (*ttext)
 {
   if (*ttext=='\t')
	++pp;
   ++ttext;
 }
 yylloc.last_column+=strlen(text)+pp*3;
}

/*! Increments a line
*/
void compute()
{
 ++(yylloc.last_line);
 yylloc.last_column=1;
}

/*! Saves a location with new line
*/
void save()
{
 yylloc.first_column=yylloc.last_column;
 yylloc.first_line=yylloc.last_line;
 compute();
}
/*! Saves a location without a new line
	\param[in] yytext text data
*/
void save(const char * yytext)
{
  yylloc.first_column=yylloc.last_column;
  yylloc.first_line=yylloc.last_line;
  compute(yytext);
}

void increment(int amount)
{
 yylloc.first_column=yylloc.last_column;
 yylloc.first_line=yylloc.last_line;
 yylloc.last_column+=amount; 
}
